//
//  ShopListTableViewCell.m
//  SafeFoodManagerDemo
//
//  Created by bob on 2017/10/23.
//  Copyright © 2017年 bob. All rights reserved.
//

#import "ShopListTableViewCell.h"

@implementation ShopListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(void)setModel:(ShopAndOpenData *)model
{
    _model=model;
    
    
    if (model.isMember == 1) {
        //创建富文本
        NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:model.shopName];
    
        //NSTextAttachment可以将要插入的图片作为特殊字符处理
        NSTextAttachment *attch = [[NSTextAttachment alloc] init];
        //定义图片内容及位置和大小
        attch.image = [UIImage imageNamed:@"vip.png"];
        attch.bounds = CGRectMake(0, 0, 40, 40);
        //创建带有图片的富文本
        NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:attch];
        
        
        
        //将图片放在最后一位
        [attri appendAttributedString:string];
        self.shopNameLabel.attributedText=attri;
        
        
        
    }else{
        
        self.shopNameLabel.text=model.shopName;
        
    }
    
    
    
    self.shopAdressLabel.text=model.shopAddress;
    
    if (self.isClick) {
        
        if (model.Seleclt) {
            
            self.editImageView.image=[UIImage imageNamed:@"Select"];
            
        }else{
            
            self.editImageView.image=[UIImage imageNamed:@"UnSelect"];
        }
    }
    
}


-(void)setIsClick:(BOOL)isClick
{
    _isClick=isClick;
    
    if (self.isClick) {
        self.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    }else{
        self.accessoryType=UITableViewCellAccessoryNone;
    }
    
}

-(void)setDeleStatue:(BOOL)deleStatue
{
    _deleStatue=deleStatue;
    
    if (deleStatue) {
        
        self.editImageView.hidden=NO;
        
        self.accessoryType=UITableViewCellAccessoryNone;
        
    }else{
        
        self.editImageView.hidden=YES;
        
        self.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        
    }
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
